package com.hankol.newretail.api

import com.baselibrary.base.BasicListBean
import com.baselibrary.bean.ReceiveAddressBean
import com.baselibrary.bean.WxPaySignBean
import com.baselibrary.net.result.HttpResult
import com.hankol.newretail.bean.*
import com.hankol.newretail.bean.goods_details.GoodsDetails
import com.hankol.newretail.bean.goods_details.GoodsGiftBean
import com.hankol.newretail.bean.goods_details.GrassShowBean
import io.reactivex.Observable
import okhttp3.RequestBody
import retrofit2.http.*

/**
 * 新零售
 *
 * @author: merbng
 * @time: 2022/8/4 11:38
 * @description:
 */
interface NewRetailApi {
    //----------------------------新零售--start-------------------------------------------------------------------------
    /**
     * 获取商城首页相关数据
     */
    @FormUrlEncoded
    @POST("mall/home/v1.29.0/confInfo")
    fun requestHomeMallInfo(@Field("useSeckill") useSeckill: Int=1): Observable<HttpResult<HomeMallInfoBean>>

    /**
     * 前端分类列表
     */
    @POST("mall/home/v1.29.0/getFrontCategoryList")
    fun requestCategoryList(): Observable<HttpResult<List<MallTabBean>>>

    /**
     * 获取商城分类 商品列表
     *
     * @author: merbng
     * @time: 2022/8/3 10:49
     * @description:
     */
    @FormUrlEncoded
    @POST("v2/mall/product/v1.29.0/getPager")
    fun requestGoodClassifyList(@Field("categoryId") categoryId: String, @Field("page") page: Int, @Field("size") pageSize: Int,@Field("useSeckill") useSeckill: Int=1): Observable<HttpResult<BasicListBean<GoodListBean>>>

    /**购物车商品数量
     * @author: merbng
     * @time: 2022/8/16 13:36
     * @description:
     */
    @POST("v2/mall/shopcart/v1.29.0/getShopCartsCount")
    fun reqShopCartNum(): Observable<HttpResult<ShopCartNumData>>

    /**
     * 地址列表  获取用户所有收货地址
     *
     * @author: merbng
     * @time: 2022/8/3 10:49
     * @description:
     */
    @POST("useraddress/v1.29.0/getUserAddresses")
    fun requestAddressList(): Observable<HttpResult<List<ReceiveAddressBean>>>

    /**
     *  新增地址
     *
     * @author: merbng
     * @time: 2022/8/3 10:49
     * @description:
     */
    @FormUrlEncoded
    @POST("useraddress/add")
    fun requestNewAddAddressList(@Field("name") name: String, @Field("phone") phone: String, @Field("areaFirst") areaFirst: String, @Field("areaSecond") areaSecond: String, @Field("areaThree") areaThree: String, @Field("address") address: String, @Field("def") def: Int): Observable<HttpResult<ReceiveAddressBean>>

    /**
     *  编辑地址
     *
     * @author: merbng
     * @time: 2022/8/3 10:49
     * @description:
     */
    @FormUrlEncoded
    @POST("useraddress/update")
    fun requestSaveEditAddressList(@Field("id") id: String, @Field("name") name: String, @Field("phone") phone: String, @Field("areaFirst") areaFirst: String, @Field("areaSecond") areaSecond: String, @Field("areaThree") areaThree: String, @Field("address") address: String, @Field("def") def: Int): Observable<HttpResult<Any>>

    /**删除地址
     * @author: merbng
     * @time: 2022/8/16 13:36
     * @description:
     */
    @FormUrlEncoded
    @POST("useraddress/del")
    fun requestDeleteAddress(@Field("id") id: String): Observable<HttpResult<Any>>

    /**设置默认地址
     * @author: merbng
     * @time: 2022/8/16 13:36
     * @description:
     */
    @FormUrlEncoded
    @POST("useraddress/v1.29.0/setDefaultAddress")
    fun requestSetDefAddress(@Field("id") id: String): Observable<HttpResult<Any>>

    //2.生成支付订单【微信支付】
    @FormUrlEncoded
    @POST("v2/order/createWxOrderAboutMallProduct")
    fun createPayOrder4wx(@Field("poids") poids: String): Observable<HttpResult<Long>>

    //2.生成支付订单【支付宝】
    @FormUrlEncoded
    @POST("v2/order/createAliOrderAboutMallProduct")
    fun createPayOrder4zfb(@Field("poids") poids: String): Observable<HttpResult<Long>>

    //3.支付【微信支付】
    @FormUrlEncoded
    @POST("order/wxOrderPayParam")
    fun requestPay4WX(@Field("oid") oid: Long): Observable<HttpResult<WxPaySignBean>>

    //3.支付【支付宝支付】
    @FormUrlEncoded
    @POST("order/aliOrderPayParam")
    fun requestPay4ZFB(@Field("oid") oid: Long): Observable<HttpResult<Any>>

    //纯酒币（无现金）_电商订单_生成支付订单_
    @FormUrlEncoded
    @POST("v2/order/v1.29.0/createScoreOrderAboutMallProduct")
    fun requestOnlyCoinPay(@Field("poids") poids: String): Observable<HttpResult<CreateScoreOrderBean>>

    /**微信支付宝 支付成功 查询 页面数据
     * @author: merbng
     * @time: 2022/8/8 16:41
     * @description:
     */
    @FormUrlEncoded
    @POST("v2/order/v1.29.0/findOrderAboutMallProduct")
    fun reqPayResultData(@Field("oid") oid: String): Observable<HttpResult<PayResultBean>>

    /**
     *订单详情
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("v2/mall/productOrder/v1.29.0/load")
    fun requestOrderDetail(@Field("poId") poId: String): Observable<HttpResult<OrderLoadDetailBean>>

    /**
     *从sku到确认下单页（订单预处理）
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("v2/mall/productOrder/v1.29.0/preOrderBysku")
    fun requestConfirmOrderDetail4GoodsDetail(@Field("num") num: String, @Field("skuId") skuId: String,@Field("useSeckill") useSeckill: Int=1): Observable<HttpResult<OrderDetailBean>>

    /**
     *从商品详情页购买构建的订单(持久化)
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("v2/mall/productOrder/v1.29.0/createOrderFromSku")
    fun reqCommitOrder4GoodsDetail(@Field("num") num: String, @Field("skuId") skuId: String, @Field("useScoreStatus") useScoreStatus: Int, @Field("userAddressId") userAddressId: Int, @Field("desc") desc: String,@Field("useSeckill") useSeckill: Int=1): Observable<HttpResult<CommitOrderBean>>

    /**
     *从购物车构建的订单(持久化)
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("v2/mall/productOrder/v1.29.0/createOrderFromShopCart")
    fun reqCommitOrder4Cart(@Field("cartIds") cartIds: String, @Field("useScoreStatus") useScoreStatus: Int, @Field("userAddressId") userAddressId: Int, @Field("descJson") descJson: String,@Field("useSeckill") useSeckill: Int=1): Observable<HttpResult<CommitOrderBean>>

    /**
     *从购物车到确认下单页（订单预处理）
     *
     * @param token
     * @return
     */
    @FormUrlEncoded
    @POST("v2/mall/productOrder/v1.29.0/preOrderByCart")
    fun requestConfirmOrderDetail4Cart(@Field("cartIds") cartIds: String,@Field("useSeckill") useSeckill: Int=1): Observable<HttpResult<OrderDetailBean>>

    //客户端关闭未支付超时订单
    @FormUrlEncoded
    @POST("v2/mall/productOrder/overtimeNoPayCancel")
    fun requestOverTimeNoPayCancel(@Field("poId") poId: String): Observable<HttpResult<Any>>

    //取消原因列表
    @POST("v2/mall/productOrder/v1.29.0/cancelReasonList")
    fun reqCancelOrderReasonList(): Observable<HttpResult<List<CancelReasonListBean>>>

    //快递信息
    @FormUrlEncoded
    @POST("v2/mall/productOrder/queryKuaiDi")
    fun reqLogisticsInfo(@Field("poId") poId: String): Observable<HttpResult<LogisticeInfoBean>>

    //  用户取消订单  rollbackCart:提交后将本单商品放回购物车：0否，1是
    @FormUrlEncoded
    @POST("v2/mall/productOrder/v1.29.0/cancelByUser")
    fun reqCancelOrder(@Field("poId") poId: String, @Field("cancellationId") cancellationId: Int, @Field("rollbackCart") rollbackCart: Int): Observable<HttpResult<Any>>

    //商品详情
    @FormUrlEncoded
    @POST("v2/mall/product/v1.29.0/load")
    fun reqGoodsDetails(@Field("spuId") spuId: Long,@Field("skuId") skuId: Long): Observable<HttpResult<GoodsDetails>>


    //商品相关推荐 type: 0-后端分类id数组字符串，1-商品spuId数组字符串，2-商品订单id数组字符串,3-默认(不需要传ids)
    @FormUrlEncoded
    @POST("v2/mall/product/v1.31.0/getGuessLikePager")
    fun reqGoodsDetailsRecommend(@Field("ids") ids: String, @Field("type") type: Int,@Field("shopId") shopId: Int, @Field("page") page: Int, @Field("size") size: Int,@Field("useSeckill") useSeckill: Int=1): Observable<HttpResult<BasicListBean<GoodListBean>>>

    //赠品详情
    @FormUrlEncoded
    @POST("v2/mall/product/v1.0/getMallProductGiftData")
    fun reqGoodsDetailsGiftData(@Field("skuId") skuId: Int, @Field("spuId") spuId: Int): Observable<HttpResult<GoodsGiftBean>>

    //种草秀
    @FormUrlEncoded
    @POST("v2/mall/product/v1.29.0/bindingTimelines")
    fun reqGoodsDetailsGrassShow(@Field("spuId") spuId: Long, @Field("page") page: Int, @Field("size") size: Int): Observable<HttpResult<BasicListBean<GrassShowBean>>>

    //商品详情页评价
    @FormUrlEncoded
    @POST("mall/productComment/v1.31.0/getCommentPagerBySpuId")
    fun reqGoodsDetailEvaluation(@Field("spuId") spuId: Long, @Field("page") page: Int, @Field("size") size: Int): Observable<HttpResult<BasicListBean<EvaluationBean>>>

    //我的订单列表
    @FormUrlEncoded
    @POST("v2/mall/productOrder/v1.29.0/getMyOrderPager")
    fun reqMyOrderList(@Field("status") status: Int?, @Field("keyword") keyword: String, @Field("page") page: Int, @Field("size") size: Int): Observable<HttpResult<BasicListBean<MyOrderListBean>>>

    //确认收货
    @FormUrlEncoded
    @POST("v2/mall/productOrder/receiveOrder2")
    fun requestConfirmRecive(@Field("poId") poId: String): Observable<HttpResult<ReceiveOrderBean>>

    //确认收货（预处理，判断是否有正在处理的售后单）
    @FormUrlEncoded
    @POST("v2/mall/productOrder/preReceiveOrder")
    fun reqPreConfirmReceive(@Field("poId") poId: String): Observable<HttpResult<Boolean>>

    //删除订单
    @FormUrlEncoded
    @POST("v2/mall/productOrder/delOrder")
    fun requestDelOrder(@Field("poId") poId: String): Observable<HttpResult<Boolean>>

    /**
     * 修改收货地址
     *
     * @author: merbng
     * @time: 2021/10/25 9:27
     * @description:
     */
    @FormUrlEncoded
    @POST("v2/mall/productOrder/updateAddress")
    fun reqChangeReciveAddress(@Field("poId") poId: String, @Field("userAddressId") userAddressId: Int): Observable<HttpResult<Boolean>>

    /**
     * 设置选中地址
     *
     * @author: merbng
     * @time: 2021/10/25 9:27
     * @description:
     */
    @FormUrlEncoded
    @POST("useraddress/v1.29.0/setSelected")
    fun reqSetSelectAddress(@Field("id") id: Int): Observable<HttpResult<Boolean>>


    /**
     * 售后单详情
     */
    @FormUrlEncoded
    @POST("mall/aftersale/v1.31.0/loadAfterSale")
    fun reqLoadAfterSale(@Field("afterSaleId") afterSaleId: Long): Observable<HttpResult<AfterSalesInfoBean>>

    /**
     * 售后订单列表
     */
    @FormUrlEncoded
    @POST("mall/aftersale/v1.29.0/getPagerAfterSale")
    fun reqAfterSaleList(@Field("page") page: Int, @Field("size") size: Int): Observable<HttpResult<BasicListBean<AfterSaleListBean>>>


    /**
     * 售后撤销申请
     */
    @FormUrlEncoded
    @POST("mall/aftersale/v1.29.0/destoryAfterSale")
    fun reqRevokeAfterSale(@Field("afterSaleId") afterSaleId: Long): Observable<HttpResult<AfterSalesRevokeBean>>

    /**
     * 售后申请
     */
    @POST("mall/aftersale/v1.31.0/requestAfterSale")
    fun reqApplyAfterSale(@Body body: RequestBody): Observable<HttpResult<AfterSalesInfoBean>>

    /**
     * 购物车列表
     */
    @FormUrlEncoded
    @POST("v2/mall/shopcart/v1.29.0/getShopCartList")
    fun reqShopCartList(@Field("useSeckill") useSeckill: Int=1): Observable<HttpResult<ArrayList<ShopCartBean>>>

    /**
     * 购物车选中
     */
    @FormUrlEncoded
    @POST("v2/mall/shopcart/v1.29.0/selected")
    fun reqSelectCartShop(@Field("cartIds") cartIds: String, @Field("selected") selected: Int): Observable<HttpResult<Any>>

    /**
     * 删除购物车信息
     */
    @FormUrlEncoded
    @POST("v2/mall/shopcart/v1.29.0/del")
    fun reqDelCartShop(@Field("ids") ids: String): Observable<HttpResult<AfterSalesRevokeBean>>

    /**
     * 申请详情
     */
    @POST("fans/apply/load")
    fun reqFansApplyDetail(): Observable<HttpResult<Any>>

    /**
     * 添加购物车
     */
    @FormUrlEncoded
    @POST("v2/mall/shopcart/v1.29.0/add")
    fun reqAddCartShop(@Field("autoMaxNum") autoMaxNum: Int, @Field("num") num: Int, @Field("skuid") skuid: Long): Observable<HttpResult<ShopCartAddBean>>

    //自动确认收货（客户端倒计时结束调用）
    @FormUrlEncoded
    @POST("v2/mall/productOrder/v1.29.0/autoReceiveByUser")
    fun requestOverTimeAutoReceive(@Field("poId") poId: String): Observable<HttpResult<OverTimeReceiveBean>>

    //我的评价列表
    @FormUrlEncoded
    @POST("mall/productComment/v1.31.0/getCommentPager4me")
    fun requestMyEvaluationList(@Field("type") type: Int, @Field("page") page: Int, @Field("size") pageSize: Int): Observable<HttpResult<BasicListBean<EvaluationBean>>>


    //根据店铺id查询商品列表
    @FormUrlEncoded
    @POST("v2/mall/product/v1.31.0/getPagerByShopId")
    fun reqAllStoreGoods(@Field("shopId") shopId: Int, @Field("page") page: Int, @Field("size") size: Int,@Field("useSeckill") useSeckill: Int=1): Observable<HttpResult<BasicListBean<GoodListBean>>>

    //评价配置信息
    @FormUrlEncoded
    @POST("mall/productComment/v1.31.0/commentConfigInfo")
    fun requestEvaluationConfig(@Field("productInfo") productInfo: Int): Observable<HttpResult<EvaluationConfigBean>>

    //添加评价
    @POST("mall/productComment/v1.31.0/add")
    fun requestAddEvaluation( @Body body: RequestBody): Observable<HttpResult<PublishEvaluationBean>>

    //秒杀配置
    @POST("seckill/category/getSeckillConf")
    fun requestSeckillConfig(): Observable<HttpResult<SeckillConfigBean>>

    //秒杀分类
    @POST("seckill/category/getSeckillCategoryList")
    fun requestSeckillCategory(): Observable<HttpResult<ArrayList<SeckillCategoryBean>>>

    //秒杀分类商品
    @FormUrlEncoded
    @POST("seckill/category/getSeckillCategoryActList")
    fun requestSeckillCategoryActList(@Field("cid") cid: Int, @Field("page") page: Int, @Field("size") size: Int): Observable<HttpResult<BasicListBean<SeckillCategoryActList>>>

    //获取酒窖秒杀商品列表
    @FormUrlEncoded
    @POST("seckill/category/getSeckillWineryActList")
    fun requestSeckillWineryActList(@Field("shopId") shopId: Int, @Field("page") page: Int, @Field("size") size: Int): Observable<HttpResult<BasicListBean<SeckillCategoryActList>>>

//----------------------------新零售--end-------------------------------------------------------------------------
}